#pragma once
#include "RBTree_Set_Map.h"
namespace bit
{
	template <class K, class V>
	class map
	{
		struct Oft
		{
			const K& operator()(const pair<K, V>& data)
			{
				return data.first;
			}
		};	
	public:
		typedef typename RBTreeNode<pair<const K, V>> Node;
		typedef typename RBTree<K, pair<const K, V>, Oft>::iterator iterator;
		typedef typename RBTree<K, pair<const K, V>, Oft>::const_iterator const_iterator;

		iterator begin()
		{
			return _m.begin();
		}
		iterator end()
		{
			return _m.end();
		}
		const_iterator begin() const
		{
			return _m.begin();
		}
		const_iterator end() const
		{
			return _m.end();
		}

		pair<iterator, bool> insert(const pair<K, V>& data)
		{
			return _m.Insert(data);
		}
	private:
		RBTree<K, pair<const K, V>, Oft> _m;
	};
	void MapTest()
	{
		map<int, int> m;
		int a[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
		for (auto e : a)
		{
			m.insert(make_pair(e, e));
		}
		map<int, int>::iterator it = m.begin();
		cout << it->first << " " << it->second << endl;
		it++;
		cout << it->first << " " << it->second << endl;
		
	}
}